home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_200
/
283_02
/
crc.doc
< prev
next >
Wrap
Text File
|
1984-12-30
|
5KB
|
118 lines
CRC for MSDOS & Concurrent PC-DOS
by Howard Vigorita, NYACC CP/M SIG
upload comments, etc. to: (718) 539-3338 (BBS)
This is a MSDOS generic program derived from the CP/M-86
version by Bill Bolton found on SIG/M Volume #210. MSDOS 2.0 or
higher is required for operation. This is a disk file CRC
checking and generating utility originally written for CP/M-80,
CP/M-86, MP/M-86 and Concurrent PC-DOS, now available for MSDOS.
CRC will run on systems with as little as 25K of RAM.
CRC is a companion utility to CRCBUILD which creates -CATALOG
files. This utility uses the -CATALOG file as an interactive look
up table and displays *MATCH* on your screen next to each line
whose embedded CRC agrees with disk contents. This CRC utility
may be used to verify the integrity of PC-BLUE or SIG/M public
domain distribution disks, all of which contain a standard format
-CATALOG file.
This utility will optionally create an output file on
the default drive, listing the CRC's of all files checked in a
single session. That output file may be used in place of the
-CATALOG file to perform integrity checks.
COMMANDS:
CRC [drive:]<filename.filetype> [F]
Examples:
CRC Will attempt to find CRCKLIST.???,
or CRCKFILE.??? or -CATALOG.???
and try to match recorded CRC values
in that file with values calculated
on the fly for files on the disk.
CRC MYFILE.ASM Check only MYFILE.ASM
CRC B:*.ASM Check all .ASM files ON B: drive
CRC *.* F Check all files, writing output to a file
Hidden files as well as files with the '$$$' extention are
ignored.
Path names as part of the file specification are not
supported in this version. To check the CRC of files in a
sub-directory, first log in that sub-directory, then run CRC
from a different drive with the drive designation of the sub-
directory as part of the file specification. To run CRC from
the root directory of the A: drive and CRC all files on the
\user\progs\asm sub-directory of the B: drive, do the following:
A>cd B:\user\progs\asm
A>CRC B:*.*
ALGORITHM NOTES
The cyclic-redundancy-checksum (CRC) used in this program
is based on the following CCITT standard polynominal:
X^16 + X^15 + X^13 + X^7 + X^4 + X^2 + X + 1
A CRC is a 16 bit number which is derived by forming a hash
total of each byte contained in a file. A CRC differs from a
simple arithmetic checksum in that bit shifting is applied giving
the CRC byte order sensitivity. XMODEM, which implements both
simple checksum as well as CRC protocol has been determined to
detect 95% of transmission errors using checksums as oposed to
99.95% with the same CCITT CRC employed here.
Special attention in this implementation has been given
to insure that it generates CRC's which are not only compatable
with SIG/M -CATALOG files and XMODEM CRC's, but which are also
communication chanel insensitive. Generated CRC's will remain
unchanged when files are moved from MSDOS or UNIX through
communication's chanels which pad file resolution to 128 byte
block boundaries. It is thus useful for checking the accuracy of
such file transfers.
This implementation achieves much greater accuracy than a
simple checksum with virtually no performance penalty. The CRC
algorithm employed herein uses the XOR mask and word shifting
techniques which prove table lookup methods slow by comparison.
See Greg Morse's article in BYTE, Septmeber 1986, page 115 for
the details of the mathematical theory. Sceptics may set the
CRC_ENABLE equate FALSE to assemble a version of this utility
which excludes the CRC generation subroutine and thus determine
by subtraction the amount of time consumed by that algorithm. The
CRC disabled version also makes for an interesting comparision
with the directory searching and disk reading efficiency of "COPY
*.* NUL". See, Dr. Dobbs Journal, "MS DOS Disk Speed" by D. E.
Cortesi, September 1985, page 12.
SPECIAL MSDOS NOTE
This CRC version fixes a bug in some MSDOS versions whereby
partial sectors of files were not being processed. Such versions
generate "00 00" CRC values for files less than 128 bytes in length
and incorrect values for files not an exact multiple of 128 bytes
long. Use this version of CRC with CRCBUILD version 1.1 or greater
which also fixes this bug.
CREDITS
The 8 bit version of the program was originally conceived
by Keith Petersen, W8SDZ, to whom all glory and honour. Due to
the scarcity of source code in the MSDOS public domain, the MSDOS
version of this program has been derived from the CP/M-86 version
by Bill Bolton, Software Tools BBS, Australia. Many thanks to
Bill Bolton and the many other CP/M-86 programmers who continue
enable the rest of us to learn from their examples in the best
spirt of the public domain.